refactor(forms): share FormCodeBadge and fix code overflow on the detail page#734
Conversation
…page
Extract the split-code badge from the search results into a shared
`form-code-badge` module and reuse it on the form detail page, so long
codes with a trailing qualifier ("6B Attachment") no longer overflow.
- Add a responsive `hero` variant for the large detail-page badge
(h-14 -> sm:h-24), scaling the head across breakpoints.
- Replace the detail-page hero badge, which rendered the raw code at
text-4xl in a fixed square and clipped/wrapped attachment codes.
- Replace the inline code in the decision-context "Current" card with the
compact badge so the code and qualifier read as one contained chip.
- forms-search-results-page now imports the shared badge instead of a
local copy; visual output is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJY1EzEXiBayz13Q6p2GwL
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Follow-up to the merged results-badge fix (#728): the same overflow existed on the form detail page, where the large hero badge rendered the raw code (
6B Attachment) attext-4xlin a fixed square and clipped/wrapped it.src/components/forms/form-code-badge.tsxmodule (FormCodeBadge+splitFormCode), so the head/qualifier split, sizing, and accessibility handling live in one place.herovariant (h-14 →sm:h-24) for the large detail-page badge, scaling the head across breakpoints.<FormCodeBadge variant="hero" />, and the inline code in the decision-context Current card with<FormCodeBadge variant="sm" />, so the code + qualifier read as one contained chip instead of large wrapping text.forms-search-results-page.tsxnow imports the shared badge instead of its local copy — visual output there is unchanged.Scope note: presentational only. It is classified clinical-risk purely because
forms-search-results-page.tsxcontains "search" in its name; the Clinical Governance Preflight below is completed on that basis and every listed invariant is genuinely untouched. No data, routing, retrieval, answer, ingestion, or governance behaviour changed. The accessible full-code string (sr-only) is preserved for both badges, so screen readers and text queries still see the complete code.Verification
npx eslinton the three changed files — cleannpx prettier --checkon the three changed files — cleannode scripts/check-type-scale.mjs --strict— passes (no arbitrary font sizes)npx vitest run tests/forms.test.ts tests/forms-clipboard-fallback.test.ts— 6/6 passnpm run typecheck— no new errors in the changed files (pre-existing failures are all missing@testing-library/@axe-core/playwrightdev deps intests/, identical on the base branch)/forms/form-6b-attachment(attachment code) at desktop + mobile shows6B / ATTACHMENTfully contained in the hero and decision-context badges;/forms/form-10a(3-char code) and normal codes render with no regressionnpm run verify:uigate requires@axe-core/playwright, which is not installed in this environment; verified visually with the pre-installed Chromium viaplaywright-coreinstead.Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
smbadge; on the narrow mobile hero (56px) it truncates with an ellipsis and carries atitletooltip with the full text.🤖 Generated with Claude Code
Generated by Claude Code